package com.hangxintong.common.feign;

import com.hangxintong.common.base.entity.LmUser;
import com.hangxintong.common.base.entity.LmUserRelation;
import com.hangxintong.common.config.FeignConfiguration;
import com.hangxintong.common.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

/**
 * @Auther: tsj
 * @Date: 2020/12/11 15:32
 * @Description:
 */
@FeignClient(value = "coalition", configuration = FeignConfiguration.class)
public interface UserFegin {


    @GetMapping("/openFegin/member/findByIdentity")
    LmUser findByIdentity(@RequestParam(name = "companyCode") String companyCode);


    @PostMapping("/openFegin/member/userInfo")
    Result userInfo(@RequestParam(value = "uid", defaultValue = "", required = false) Integer uid);


    @GetMapping("/openFegin/member/getUserByMobile")
    LmUser getUserByMobile(@RequestParam(name = "mobile") String mobile);


    @PostMapping(value = "/openFegin/member/userReg")
    Result userReg(@RequestParam(value = "username", required = true) String username,
                   @RequestParam(value = "mobile", required = true) String mobile,
                   @RequestParam(value = "password",required = false) String password);


    @PostMapping("/openFegin/member/saveUserRelation")
    LmUserRelation saveUserRelation(@RequestBody @Valid LmUserRelation userRelation);

    /**
     * 查询所有关系列表
     *
     * @param type
     * @return
     * @author mxf 20201-01-05
     */
    @GetMapping("/openFegin/member/relation/lists")
    List<LmUserRelation> queryRelationList(@RequestParam("type") Integer type,
                                           @RequestParam("isJoin") Integer isJoin);


    /**
     * 通过手机号查询用户加入的企业信息
     */
     @GetMapping("/openFegin/member/getUserRelationByMobile")
     List<LmUserRelation> findByMobile(@RequestParam String oldMobile);

     /**
      *查询人员和企业关系
      *
      * @Author Mr.zhang
      * @Date 2021/1/16 0016 15:30
      * @Param [uid, cid, ctype]
      * @return com.hangxintong.common.utils.Result
      **/
    @GetMapping("/user/userJoinRelation")
    Result userJoinRelation(@RequestParam Integer uid,@RequestParam Integer cid,@RequestParam Integer ctype);
}

